# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=rizin
pkgver=0.6.3
pkgrel=1
pkgdesc='Open-source tools to disasm, debug, analyze and manipulate binary files'
url='https://rizin.re'
arch=('loong64' 'x86_64')
license=('GPL3' 'LGPL3')
depends=(
  sh
  capstone libcapstone.so
  openssl
  libzip libzip.so
  zlib
  lz4
  xz
  xxhash libxxhash.so
  file libmagic.so
  tree-sitter libtree-sitter.so
  libmspack libmspack.so
)
makedepends=('meson' 'ninja' 'python' 'python-yaml')
optdepends=('rz-ghidra: ghidra decompiler plugin')
options=('!emptydirs')
source=(https://github.com/rizinorg/rizin/releases/download/v${pkgver}/rizin-src-v${pkgver}.tar.xz)
sha512sums=('031ae1c5b43237d55b3e48d825d4bd9cda16a4a84a47464eb1745a02265a1412e2864345595c0dca7f8ea0cb348fe9760ea424556ff6b915ac8014a7f410b03c')
b2sums=('4ddde26dc2541917e1d16f38339bf1467b2148524a1365d739c417857ee856ecb7fbc9210a0f3b562a429c962e31f637bb88a0c0817f42a59868ed3093b0e902')

build() {
  cd ${pkgname}-v${pkgver}
  arch-meson build \
    -D use_sys_capstone=enabled \
    -D use_capstone_version=v4 \
    -D use_sys_magic=enabled \
    -D use_sys_libzip=enabled \
    -D use_sys_lz4=enabled \
    -D use_sys_lzma=enabled \
    -D use_sys_zlib=enabled \
    -D use_sys_xxhash=enabled \
    -D use_sys_openssl=enabled \
    -D use_sys_tree_sitter=enabled \
    -D use_sys_libmspack=enabled \
    -D use_zlib=true \
    -D use_lzma=true \
    -D local=disabled
  ninja -C build
}

package() {
  cd ${pkgname}-v${pkgver}
  DESTDIR="${pkgdir}" ninja -C build install
  install -d "${pkgdir}/usr/share/doc/rizin"
  cp -r doc/* "${pkgdir}/usr/share/doc/rizin"
}

# vim: ts=2 sw=2 et:
